﻿@model ChurchDiary.TableEntity.EntityDefaultLabels
<script src="~/Scripts/SettingsControllers/DefaultConfigurationController.js"></script>
<div class="row" ng-controller="defaultConfig">
    <div class="col-md-12">
        <div class="bg-white bs-0 widget">
            <div class="p-10 bg-black bs-inset-primary clearfix">
                <h3 class="pull-left pt-2 fs-16 lh-1 m-0 text-uppercase">@Html.LabelFor(m => m.DefaultKeyvalues)</h3>
                <ul class="pull-right list-inline fs-16 lh-1 mb-0">
                    <li><a href="javascript:;" class="text-white" ng-click="addUpdate('add','','Add New Default Key');"><i class="fs-20 fa fa-plus-circle"></i></a></li>
                </ul>
            </div>
            <div class="widget-body">
                <div class="row">
                    <div class="col-md-12" ng-show="filteredItems > 0">
                        <table class="table table-striped table-bordered">
                            <thead>
                                <th>@Html.LabelFor(m => m.KeyName)&nbsp;<a ng-click="sort_by('KeyName');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                <th>@Html.LabelFor(m => m.KeyValue)&nbsp;<a ng-click="sort_by('KeyValue');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                <th>@Html.LabelFor(m => m.KeyDesc)&nbsp;<a ng-click="sort_by('KeyDesc');"><i class="glyphicon glyphicon-sort"></i></a></th>
                                <th>@Html.LabelFor(m => m.Action)&nbsp;</th>
                            </thead>
                            <tbody>
                                <tr ng-repeat="data in filtered = (list | filter:search | orderBy : predicate :reverse) | startFrom:(currentPage-1)*entryLimit | limitTo:entryLimit">
                                    <td>{{data.KeyName}}</td>
                                    <td>{{data.KeyValue}}</td>
                                    <td>{{data.KeyDesc}}</td>
                                    <td>
                                        <div class="btn-group-sm" role="group" aria-label="Second group">
                                            <button type="button" class="btn btn-info waves-effect"  ng-click="addUpdate('edit',data,'Edit New Default Key');"><i class="fa fa-pencil"></i></button>
                                            <button type="button" class="btn btn-danger waves-effect" ng-click="delete(data.KeyName,data.KeyId)" ><i class="fa fa-trash"></i></button>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="col-md-12" ng-show="filteredItems == 0">
                        <div class="col-md-12" style="text-align:center;">
                            <h4>No data available</h4>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-md-12" ng-show="filteredItems > 0" style="padding: 0px; text-align: right;">
            <div pagination="" page="currentPage" on-select-page="setPage(page)" boundary-links="true" total-items="filteredItems" items-per-page="entryLimit" class="pagination-small" previous-text="&laquo;" next-text="&raquo;"></div>
        </div>
    </div>
    <div class="modal fade bs-example-modal-panel" tabindex="-1" id="addupdatemodel" role="dialog" aria-labelledby="myPanelModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header bg-primary">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myAnimationModalLabel">{{title}}</h4>
                </div>
                <form name="fromvalidate" novalidate>
                    <div class="modal-body">
                        <div class="form-group">
                            @Html.LabelFor(m => m.KeyName)
                            <input type="text" class="form-control" name="KeyName" ng-model="data.KeyName" value="{{data.KeyName}}" maxlength="100" required>
                            <span style="color: red" ng-show="validationstatus || fromvalidate.KeyName.$dirty && fromvalidate.KeyName.$invalid ">
                                <span ng-show="fromvalidate.KeyName.$error.required">@Html.LabelFor(m => m.KeyName)&nbsp;@Html.LabelFor(m => m.IsRequired)</span>
                            </span>
                        </div>
                        <div class="form-group">
                            @Html.LabelFor(m => m.KeyValue)
                            <input type="text" class="form-control" name="KeyValue" ng-model="data.KeyValue" maxlength="100" value="{{data.KeyValue}}" required>
                            <span style="color: red" ng-show="validationstatus || fromvalidate.KeyValue.$dirty && fromvalidate.KeyValue.$invalid || validationstatus">
                                <span ng-show="fromvalidate.KeyValue.$error.required">@Html.LabelFor(m => m.KeyValue)&nbsp;@Html.LabelFor(m => m.IsRequired)</span>
                            </span>
                        </div>
                        <div class="form-group">
                            @Html.LabelFor(m => m.KeyDesc)
                            <input type="text" class="form-control" name="KeyDesc" ng-model="data.KeyDesc" maxlength="200" value="{{data.KeyDesc}}" required>
                            <span style="color: red" ng-show="validationstatus || fromvalidate.KeyDesc.$dirty && fromvalidate.KeyDesc.$invalid || validationstatus">
                                <span ng-show="fromvalidate.KeyDesc.$error.required">@Html.LabelFor(m => m.KeyDesc)&nbsp;@Html.LabelFor(m => m.IsRequired)</span>
                            </span>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary" ng-disabled="fromvalidate.$invalid || requeststatus" ng-click="SaveUpdate(data)">Save</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
